<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
    
  
  <link href="//cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.min.css" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






  

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Chrome," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="快速切换文件我一般如果查找每个文件，一般都是打开控制台，在source控制面板里面一个一个去找，看下面的图你就应该知道，这么多文件，你都不知道在哪个目录下面，然后就只能一个一个点开看

后来才发现原来按Ctrl+P（cmd+p on mac）,就能快速搜寻和打开你项目的文件

在源代码中搜索大家都知道如果在要在Elements查看源码，只要定位到Elements面板，然后按ctrl+f就可以了">
<meta property="og:type" content="article">
<meta property="og:title" content="Chorme使用技巧">
<meta property="og:url" content="https://zitongchen.github.io/2017/03/18/Chorme使用技巧/index.html">
<meta property="og:site_name" content="Tony's Notes">
<meta property="og:description" content="快速切换文件我一般如果查找每个文件，一般都是打开控制台，在source控制面板里面一个一个去找，看下面的图你就应该知道，这么多文件，你都不知道在哪个目录下面，然后就只能一个一个点开看

后来才发现原来按Ctrl+P（cmd+p on mac）,就能快速搜寻和打开你项目的文件

在源代码中搜索大家都知道如果在要在Elements查看源码，只要定位到Elements面板，然后按ctrl+f就可以了">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/011952479411904.png">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/011954297544707.gif">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/011956582078260.png">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/011957408941336.png">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/012140236601662.gif">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/012141031295219.gif">
<meta property="og:image" content="http://files.cnblogs.com/files/liyunhua/chrome_ctrip.gif">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/012209017583482.gif">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/020802215238745.gif">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/020803011023803.gif">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/020803196337530.gif">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/020807330865161.gif">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/020803377896144.jpg">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/020804436174222.gif">
<meta property="og:image" content="http://images0.cnblogs.com/blog2015/755265/201506/020805181959418.gif">
<meta property="og:updated_time" content="2017-03-18T14:49:12.952Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Chorme使用技巧">
<meta name="twitter:description" content="快速切换文件我一般如果查找每个文件，一般都是打开控制台，在source控制面板里面一个一个去找，看下面的图你就应该知道，这么多文件，你都不知道在哪个目录下面，然后就只能一个一个点开看

后来才发现原来按Ctrl+P（cmd+p on mac）,就能快速搜寻和打开你项目的文件

在源代码中搜索大家都知道如果在要在Elements查看源码，只要定位到Elements面板，然后按ctrl+f就可以了">
<meta name="twitter:image" content="http://images0.cnblogs.com/blog2015/755265/201506/011952479411904.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://zitongchen.github.io/2017/03/18/Chorme使用技巧/"/>





  <title> Chorme使用技巧 | Tony's Notes </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  














  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Tony's Notes</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://zitongchen.github.io/2017/03/18/Chorme使用技巧/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Tony">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avater.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Tony's Notes">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Chorme使用技巧
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-03-18T00:00:00+08:00">
                2017-03-18
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Chrome/" itemprop="url" rel="index">
                    <span itemprop="name">Chrome</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          
             <span id="/2017/03/18/Chorme使用技巧/" class="leancloud_visitors" data-flag-title="Chorme使用技巧">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数 </span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="快速切换文件"><a href="#快速切换文件" class="headerlink" title="快速切换文件"></a>快速切换文件</h2><p>我一般如果查找每个文件，一般都是打开控制台，在source控制面板里面一个一个去找，看下面的图你就应该知道，这么多文件，你都不知道在哪个目录下面，然后就只能一个一个点开看</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/011952479411904.png" alt=""></p>
<p>后来才发现原来按Ctrl+P（cmd+p on mac）,就能快速搜寻和打开你项目的文件</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/011954297544707.gif" alt=""></p>
<h2 id="在源代码中搜索"><a href="#在源代码中搜索" class="headerlink" title="在源代码中搜索"></a>在源代码中搜索</h2><p>大家都知道如果在要在Elements查看源码，只要定位到Elements面板，然后按ctrl+f就可以了</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/011956582078260.png" alt=""></p>
<p>可是如果你希望在源代码中搜索要怎么办呢？在页面已经加载的文件中搜寻一个特定的字符串，快捷键是Ctrl + Shift + F (Cmd + Opt + F)，这种搜寻方式还支持正则表达式哦、</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/011957408941336.png" alt=""></p>
<h2 id="在源代码中快速跳转到指定的行"><a href="#在源代码中快速跳转到指定的行" class="headerlink" title="在源代码中快速跳转到指定的行"></a>在源代码中快速跳转到指定的行</h2><p>大家都知道在VS里，一个cs文件可能特别多行，然后我们就是使用ctrl+g快捷键来跳转到特定的行，事实上在chrome控制台也是一样的，在Sources标签中打开一个文件之后，按Ctrl + G，(or Cmd + L for Mac)，然后输入行号，chrome控制台就会跳转到你输入的行号所在的行</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/012140236601662.gif" alt=""></p>
<h2 id="使用多个插入符进行选择"><a href="#使用多个插入符进行选择" class="headerlink" title="使用多个插入符进行选择"></a>使用多个插入符进行选择</h2><p>当编辑一个文件的时候，你可以按住Ctrl在你要编辑的地方点击鼠标，可以设置多个插入符，这样可以一次在多个地方编辑</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/012141031295219.gif" alt=""></p>
<h2 id="设备模式"><a href="#设备模式" class="headerlink" title="设备模式"></a>设备模式</h2><p>最近用H5做携程商旅APP，用的最多的就是chrome浏览器的设备模式。试想一下，如果我们每在Visual studio工具上开发完一个功能又得跑到手机上调试，那得多烦，开发效率多低呀。想想就知道为什么那么多人喜欢用chrome浏览器</p>
<p><img src="http://files.cnblogs.com/files/liyunhua/chrome_ctrip.gif" alt=""></p>
<h2 id="传感器仿真"><a href="#传感器仿真" class="headerlink" title="传感器仿真"></a>传感器仿真</h2><p>设备模式的另一个很酷的功能是模拟移动设备的传感器，例如触摸屏幕和加速计。你甚至可以恶搞你的地理位置。这个功能位于元素标签的底部，点击“show drawer”按钮，就可看见<code>Emulation --&gt; Sensors</code></p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/012209017583482.gif" alt=""></p>
<h2 id="格式化凌乱的js代码"><a href="#格式化凌乱的js代码" class="headerlink" title="格式化凌乱的js代码"></a>格式化凌乱的js代码</h2><p>有时候看到压缩好的一团糟的js，都不知道从何着手去看。chrome控制台有内建的美化代码功能，可以返回一段最小化且格式易读的代码。<code>Pretty Print</code>的按钮在Sources标签的左下角</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/020802215238745.gif" alt=""></p>
<h2 id="颜色选择器"><a href="#颜色选择器" class="headerlink" title="颜色选择器"></a>颜色选择器</h2><p>当在样式编辑中选择了一个颜色属性时，你可以点击颜色预览，就会弹出一个颜色选择器。当选择器开启时，如果你停留在页面，鼠标指针会变成一个放大镜，让你去选择像素精度的颜色</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/020803011023803.gif" alt=""></p>
<h2 id="改变颜色格式"><a href="#改变颜色格式" class="headerlink" title="改变颜色格式"></a>改变颜色格式</h2><p>相信前端开发人员都知道，颜色有很多种表示方式，比如rgb,hsl,十六进制表示方法等。看了下面的这个图，我相信你肯定会佩服chrome的功能强大，连细节都做得那么好</p>
<p>在颜色预览功能使用快捷键Shift + Click，可以在rgba、hsl和hexadecimal来回切换颜色的格式</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/020803196337530.gif" alt=""></p>
<h2 id="强制改变元素状态（方便查看不同状态下元素的样式）"><a href="#强制改变元素状态（方便查看不同状态下元素的样式）" class="headerlink" title="强制改变元素状态（方便查看不同状态下元素的样式）"></a>强制改变元素状态（方便查看不同状态下元素的样式）</h2><p>chrome控制台有一个可以模拟CSS状态的功能，例如元素的hover和focus,可以很容易的改变元素样式。在CSS编辑器中可以利用这个功能查看不同状态下元素的样式，我相信这个功能对于模仿别人界面的前端爱好者来说是非常实用的</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/020807330865161.gif" alt=""></p>
<h2 id="利用chrome来查看和编辑本地文件"><a href="#利用chrome来查看和编辑本地文件" class="headerlink" title="利用chrome来查看和编辑本地文件"></a>利用chrome来查看和编辑本地文件</h2><p>事实上我们可以用chrome来查看本地文件，只要把相关目录拖到chrome浏览器中即可</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/020803377896144.jpg" alt=""></p>
<h2 id="选择下一个匹配项"><a href="#选择下一个匹配项" class="headerlink" title="选择下一个匹配项"></a>选择下一个匹配项</h2><p>当在Sources标签下编辑文件时，按下Ctrl + D (Cmd + D) ，当前选中的单词的下一个匹配也会被选中，有利于你同时对它们进行编辑</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/020804436174222.gif" alt=""></p>
<h2 id="可视化的DOM阴影"><a href="#可视化的DOM阴影" class="headerlink" title="可视化的DOM阴影"></a>可视化的DOM阴影</h2><p>eb浏览器在构建如文本框、按钮和输入框一类元素时，其它基本元素的视图是隐藏的。不过，你可以在<code>Settings -&gt; General</code> 中切换成<code>Show user agent shadow DOM</code>，这样就会在元素标签页中显示被隐藏的代码。甚至还能单独设计他们的样式，这给你了很大的控制权</p>
<p><img src="http://images0.cnblogs.com/blog2015/755265/201506/020805181959418.gif" alt=""></p>
<p>文章转载自静逸的<a href="http://www.cnblogs.com/liyunhua/p/4544738.html#_labelTop" target="_blank" rel="external">chrome使用技巧</a></p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Chrome/" rel="tag"># Chrome</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/03/16/在Win10安装MongoDB/" rel="next" title="在Win10安装MongoDB">
                <i class="fa fa-chevron-left"></i> 在Win10安装MongoDB
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/03/20/MongoDB学习(一)/" rel="prev" title="MongoDB 学习(一)">
                MongoDB 学习(一) <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>

          
          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="uyan_frame"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avater.png"
               alt="Tony" />
          <p class="site-author-name" itemprop="name">Tony</p>
           
              <p class="site-description motion-element" itemprop="description">学习技术，分享技术...</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">29</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">11</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">25</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/zitongchen" rel="external nofollow" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#快速切换文件"><span class="nav-number">1.</span> <span class="nav-text">快速切换文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#在源代码中搜索"><span class="nav-number">2.</span> <span class="nav-text">在源代码中搜索</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#在源代码中快速跳转到指定的行"><span class="nav-number">3.</span> <span class="nav-text">在源代码中快速跳转到指定的行</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用多个插入符进行选择"><span class="nav-number">4.</span> <span class="nav-text">使用多个插入符进行选择</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#设备模式"><span class="nav-number">5.</span> <span class="nav-text">设备模式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#传感器仿真"><span class="nav-number">6.</span> <span class="nav-text">传感器仿真</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#格式化凌乱的js代码"><span class="nav-number">7.</span> <span class="nav-text">格式化凌乱的js代码</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#颜色选择器"><span class="nav-number">8.</span> <span class="nav-text">颜色选择器</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#改变颜色格式"><span class="nav-number">9.</span> <span class="nav-text">改变颜色格式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#强制改变元素状态（方便查看不同状态下元素的样式）"><span class="nav-number">10.</span> <span class="nav-text">强制改变元素状态（方便查看不同状态下元素的样式）</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#利用chrome来查看和编辑本地文件"><span class="nav-number">11.</span> <span class="nav-text">利用chrome来查看和编辑本地文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#选择下一个匹配项"><span class="nav-number">12.</span> <span class="nav-text">选择下一个匹配项</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#可视化的DOM阴影"><span class="nav-number">13.</span> <span class="nav-text">可视化的DOM阴影</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Tony</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io" rel="external nofollow">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next" rel="external nofollow">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    
    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  




  
  <script type="text/javascript" src="//cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/fastclick/1.0.6/fastclick.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazyload/1.9.3/jquery.lazyload.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.ui.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.pack.js"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  



  




	





  





  
    

    
      <!-- UY BEGIN -->
      <script type="text/javascript" src="http://v2.uyan.cc/code/uyan.js?uid=2130825"></script>
      <!-- UY END -->
    
  





  



  
  

  

  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
  <script>AV.initialize("4wyUmphSKE5wrQGHEh5Js0bk-gzGzoHsz", "oTOHrhMuED5U0oqV2KrRMGF0");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  


  
</body>
</html>
